<?php
require '../function.php';
if(isset($_SESSION['id']) && PHP_INT_MAX == $_SESSION['id']) {
	header("Location:index.php");
	exit;
}
if(isset($_POST['name'])) {
	$name = $_POST['name'];
	$pass = $_POST['pass'];
	if('javnow_admin' == $name && 'eluid^cjy*1pq198sd!@~!89' == $pass) {
		$_SESSION['id'] = PHP_INT_MAX;
		header("Location:index.php");
		exit;
	}
	else {
		$error = true;
	}
}
?><html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<style type="text/css">
			ul, ul li {
				margin: 0px;
				padding: 0px;
				list-style: none;
			}
			ul li label {
				display: inline-block;
				*display: inline;
				width: 200px;
				text-align: right;
			}
			ul li div {
				display: inline-block;
				*display: inline;
				width: 280px;
				text-align: left;
			}
		</style>
	</head>
	<body style="text-align:center;font-family:Arial;">
		<form action="login.php" method="post">
			<div style="border:1px #2218DB solid; width:500px; margin:auto;text-align:left;">
				<div style="background-color:#4E72BC; text-align:left; color:#FFFFFF">&nbsp;管理员登陆</div>
				<?php if(isset($error) && $error) echo '<div style="color:red;">用户名或者密码错误</div>';?>
				<ul>
					<li>
						<label>用户名：</label><div><input 
						type="text" id="name" name="name" style="width:250px" /></div>
					</li>
					<li>
						<label>密码：</label><div><input 
						type="password" id="pass" name="pass" style="width:250px" /></div>
					</li>
					<li>
						<label></label><div><input 
						type="submit" value="登录" style="" /></div>
					</li>
				</ul>
			</div>
		</form>
	</body>
</html>